<include file="Public:header" />
<link href="__PUBLIC__/Catalog/css/orderlist_xiadan.css" rel="stylesheet" type="text/css" />
<script>
$(function(){
    if('{$msg}'!='0'){
        alert('{$msg}');
    }
});

function confirmOrder(orderid){
	$('#orderid').val(orderid);
	$('#orderconfirm').css('display','block');
}

function complainOrder(orderid,complaintype){
	$('#sorderid').val(orderid);
	$('#complaintype').val(complaintype);
	$('#complainForm').css('display','block');
}
</script>
</head>
<body>
<div class="main">
   <div class="title">
         <div class="title1">
             <a href="{:U('Membership/index')}" id="back"> < </a>订单管理
         </div>
   </div>
    <div class="filter">
        <div class="filter2">
           <a href="{:U('Membership/ordermanage')}?bsflag=1" class="are <if condition='$bsflag eq 1'>filterhot</if>">买入</a>
           <a href="{:U('Membership/ordermanage')}?bsflag=2" class="supply <if condition='$bsflag eq 2'>filterhot</if>">卖出</a>
        </div>
   </div>
   <div class="filter">
        <div class="filter2">
           <a href="{:U('Membership/ordermanage')}?bsflag={$bsflag}" class="are <if condition='$ostatusid eq 0'>filterhot</if>">全部订单</a>
           <a href="{:U('Membership/ordermanage')}?ostatusid=1&bsflag={$bsflag}" class="supply <if condition='$ostatusid eq 1'>filterhot</if>">已下单</a>
       	   <a href="{:U('Membership/ordermanage')}?ostatusid=3&bsflag={$bsflag}" class="brand <if condition='$ostatusid eq 3'>filterhot</if>">已确认</a>
           <a href="{:U('Membership/ordermanage')}?ostatusid=5&bsflag={$bsflag}" class="brand <if condition='$ostatusid eq 5'>filterhot</if>">已发货</a>
           <if condition="$bsflag eq 1">
           		<a href="{:U('Membership/ordermanage')}?ostatusid=6&bsflag={$bsflag}" class="price <if condition='$ostatusid eq 6'>filterhot</if>">已评价</a>
           <else/>
           		<a href="{:U('Membership/ordermanage')}?ostatusid=7&bsflag={$bsflag}" class="price <if condition='$ostatusid eq 7'>filterhot</if>">已评价</a>
           </if>
           
        </div>
   </div>
   <div class="list">
   		<foreach name="orderList" item="vo">
   			<div class="list2">
	         <dl>
	          <dt><if condition="$vo['uid'] eq $uid">【购买】<else/>【出售】</if><a href="{:U('Order/detail')}?orderid={$vo.order_id}&back=morder">{$vo.products_name}</a></dt>
	          <dd>下单时间:{$vo.order_date_added}</dd>
	          <dd>下单用户:{$vo.shipping_lastname} {$vo.tel}</dd>
	          <dd>
	          	交易方式:<span style="color:#099;"><if condition="$vo['order_type'] eq 1">线下交易<else/>线上交易</if></span> &nbsp;&nbsp;&nbsp;&nbsp;
	         	<if condition="$ostatusid eq 0">
	         	订单状态:<span style="color:red;">{$vo.os_name}</span>
	         	<else/> 
	         		支付状态:<span style="color:red;"><if condition="$vo['order_status_id'] egt 2">已支付<else/>未支付</if></span>
	         	</if>
	         	
	          </dd>
	          <dd style="text-align:center;">
		          <if condition="$vo['publish_uid'] eq $uid">
		          <!-- 卖家订单处理操作 -->
		          	<if condition=" $vo['order_type'] eq 0"><!-- 在线支付，已支付未确认 -->
		          		<if condition=" $vo['order_status_id'] eq 2">
		          			<a href="{:U('Order/confirmOrder')}?orderid={$vo.order_id}" class="a1">确认订单</a>
		          		</if>
		          	<else/><!-- 线下支付 ,未确认-->
		          		<if condition="$vo['order_status_id'] lt 3">
		          			<a href="{:U('Order/confirmOrder')}?orderid={$vo.order_id}" class="a1">确认订单</a>
		          		</if>
		          	</if>
		          	 <if condition=" $vo['order_status_id'] lt 3">
			          	<a href="{:U('Order/deleteOrder')}?orderid={$vo.order_id}&dtype=1" class="a1">取消订单</a>
			          	<if condition="$vo['order_status_id'] lt 1">
			          		<a href="javascript:complainOrder('{$vo.order_id}','3')" class="a1">订单申诉</a>
			          	</if>
			         <elseif condition="$vo['order_status_id'] eq 3" />
			         	<a href="javascript:confirmOrder('{$vo.order_id}');" class="a1">发货</a>
			         <elseif condition="$vo['order_status_id'] eq 5" />
			         	<a href="javascript:complainOrder('{$vo.order_id}','3')" class="a1">订单申诉</a>
			         	<a href="{:U('Express/getorder')}?name={$vo.delivery_company}&order={$vo.delivery_num}&orderid={$vo.order_id}" class="a1">查看物流</a>
			         	<!-- <a href="javascript:getorder('{$vo.delivery_company}','{$vo.delivery_num}');" class="a1">查看物流</a> -->
			         <elseif condition="$vo['order_status_id'] eq 6" />
			          	<a href="{:U('Order/sappraise')}?orderid={$vo.order_id}&atype=1" class="a1">交易评价</a>
			          	<a href="javascript:complainOrder('{$vo.order_id}','3')" class="a1">订单申诉</a>
			         <elseif condition="$vo['order_status_id'] eq 7" />
			          	<a href="" class="a1">已完成</a>
			         <elseif condition="$vo['order_status_id'] eq 8 or $vo['order_status_id'] eq 7" />
			         	<a href="javascript:complainOrder('{$vo.order_id}','3')" class="a1">订单申诉</a>
			         <elseif condition="$vo['order_status_id'] eq 9"/>
			         	<a href="#" class="a1">申诉中...</a>
			          </if>
		          <else/>
		          <!-- 买家订单处理操作 -->
		          	<if condition="$vo['order_type'] eq 0 && $vo['order_status_id'] eq 1">
		          		<a href="{:U('Order/payment')}?orderid={$vo.order_id}" class="a1">付款</a>
		          	</if>
		          	<if condition="$vo['order_type'] eq 1">
		          		<if condition="$vo['products_type'] neq 3"><a href="#" class="a1">在线支付</a></if>
		          	</if>
		          	 <if condition="$vo['order_status_id'] lt 3">
			          	<a href="{:U('Order/deleteOrder')}?orderid={$vo.order_id}&dtype=0" class="a1">取消订单</a>
			          <elseif condition="$vo['order_status_id'] eq 3" />
			         	 <a href="javascript:complainOrder('{$vo.order_id}','2')" class="a1">订单申诉</a>
			          <elseif condition="$vo['order_status_id'] eq 5" />
			          	<a href="{:U('Order/appraise')}?orderid={$vo.order_id}&atype=0" class="a1">收货评价</a>
			          	<a href="{:U('Express/getorder')}?name={$vo.delivery_company}&order={$vo.delivery_num}&orderid={$vo.order_id}" class="a1">查看物流</a>	
			          	<a href="javascript:complainOrder('{$vo.order_id}','2')" class="a1">订单申诉</a>		          	
			          <elseif condition="$vo['order_status_id'] eq 7 or $vo['order_status_id'] eq 6 " />
			          	<a href="" class="a1">已完成</a>
			          	<a href="javascript:complainOrder('{$vo.order_id}','2')" class="a1">订单申诉</a>
			          <elseif condition="$vo['order_status_id'] eq 9 or $vo['order_status_id'] eq 8"/>			          	
			          	<a href="#" class="a1">申诉中...</a>
			          </if>
			          
		          </if>
	          </dd>
	        </dl>
	      </div>
   		</foreach>
   </div>
   <!-- 确认物流信息 -->
<div class="foot1" style="display:none;" id="orderconfirm">
    <div class="foot2">
        <span class="foot2i">请填写物流信息：</span>
        <a class="foot2x" onclick="javascript:$('#buyconfirm').css('display','none');" ></a>
    </div>
    <div class="foot2Select">
    	<form action="{:U('Order/sendOrder')}" method="post">
	    	<input type="hidden" name="orderid" id="orderid" value=""/>
	    	<p><br/></p>
	    	<p>快递公司：
	    	<select name="deliveryCompany" required>
	    		<foreach name="express" item="vo" id="deliveryCompany">
	    			<option value="{$vo.express_name}">{$vo.express_name}</option>  
	    		</foreach>
	    	</select>
	    	<!-- <input class="oinput" type="text" name="deliveryCompany" id="deliveryCompany" value="" required /> --></p>
	    	<p><br/></p>
	    	<p>快递单号：<input class="oinput" type="text" name="deliveryNum" id="deliveryNum" value="" required/></p>
	        <p><input type="submit" class="go" value="提交信息"/></p>
        </form>
    </div>
</div>
  <!-- 交易申诉信息 -->
<div class="foot1" style="display:none;" id="complainForm">
    <div class="foot2">
        <span class="foot2i">请填写申诉信息：</span>
        <a class="foot2x" onclick="javascript:$('#complainForm').css('display','none');" ></a>
    </div>
    <div class="foot2Select">
    	<form action="{:U('Order/complain')}" method="post">
	    	<input type="hidden" name="orderid" id="sorderid" value=""/>
	    	<input type="hidden" name="complaintype" id="complaintype" value="" />
	    	<p><br/></p>
	    	<p><textarea rows="10" cols="47" name="complaintext"  placeholder="请简单描述您遇到的问题" required></textarea></p>
	        <p><input type="submit" class="go" value="提交申诉"/></p>
        </form>
    </div>
</div>
<script>
function getorder(oname,oderid){
	alert(oname);
	$.ajax({
		type:"post",
		url:"{:U('Express/getorder')}",
		datatype:'json',
		data:{name:oname,order:orderid},
		success:function(result){
			datacontent =window.JSON.parse(result);
			if(datacontent.flag==1){
				alert(datacontent.msg);
			}else {
				alert(datacontent.msg);
			}
			
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) {
			alert(XMLHttpRequest.status);
			alert(XMLHttpRequest.readyState);
			alert(textStatus);
		},
	});
}

</script>
<include file="Public:footer" />
